N = [2:65,70:5:200]';

x = load('tableData.dat');

Hnumerical = x(:,2) ./ 2;

o = optimset('MaxFunEvals',4000,'MaxIter',4000,'Display','off');

c1 = 14/15;
c2 = 1;
f1 = @(x,xdata) fitFunctionForHVariable(x,xdata,c1);
f2 = @(x,xdata) fitFunctionForHVariable(x,xdata,c2);

% n is the vector of points to fit to 
% interesting points:
% small n eg. n = [2:20]', approx fits best
% n = [2:62]' c=1 has an EXCELLENT fit, but doesnt for 61 or 63
% similar thing for n = [2:65,70:5:95]', c=14/15
% i think all this does is show how sensitive the fit is
n = [2:62]';

x1 = lsqcurvefit(f1,[0,0,0,0,0,0],n,Hnumerical(1:numel(n)),[],[],o);
x2 = lsqcurvefit(f2,[0,0,0,0,0,0],n,Hnumerical(1:numel(n)),[],[],o);
x3 = lsqcurvefit(@fitFunctionForHApprox,[0,0,0,0,0,0],n,Hnumerical(1:numel(n)),[],[],o); 

plot(N,abs(fitFunctionForHVariable(x1,N,c1) - Hnumerical),'*',N, abs(fitFunctionForHVariable(x2,N,c2) - Hnumerical),'x', N, abs(fitFunctionForHApprox(x3,N) - Hnumerical),'.');

legend(strcat('Exact c= ',num2str(c1)),strcat('Exact c= ',num2str(c2)), 'Approx');